import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/components/common/Home.vue'
// 仅演示使用，废弃
// 导入自定义【客户管理】组件，组件对象 Customer
// import Customer from '@/views/Customer.vue'
// 导入自定义【订单管理】组件，组件对象 Order
// import Order from '@/views/Order.vue'
import CommonCustomer from '@/components/pages/customer/CommonCustomer.vue'
import CustomerList from '@/components/pages/customer/CustomerList.vue'
import AllOrder from '@/components/pages/order/AllOrder.vue'
import MyOrder from '@/components/pages/order/MyOrder.vue'
import FirstPage from '@/components/pages/FirstPage.vue'
import Login from '@/components/common/Login.vue'

import SysUser from '@/components/pages/sys/sysUser.vue'
import SysRole from '@/components/pages/sys/SysRole.vue'
import SysMenu from '@/components/pages/sys/SysMenu.vue'
import Syslog from '@/components/pages/sys/Syslog.vue'


Vue.use(Router)

// 定义路由规则（添加【自定义组件】的映射关系）
export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home', //主路由
      component: Home,
      redirect:"FirstPage", //重定向到首页
      children: [
        /** 嵌套的子路由 */
        //定义路由规则，路径&路由名称&组件名称
        //首页
        {
          path: '/FirstPage',
          name: 'firstPage',
          component: FirstPage
        },
        //公海客户
        {
          path: '/CommonCustomer',
          name: 'commonCustomer',
          component: CommonCustomer
        },
        //客户列表
        {
          path: '/CustomerList',
          name: 'customerList',
          component: CustomerList
        },
        //所有订单
        {
          path: '/AllOrder',
          name: 'allOrder',
          component: AllOrder
        },
        //我的订单
        {
          path: '/MyOrder',
          name: 'myOrder',
          component: MyOrder
        },
        //用户管理
        {
          path: '/SysUser',
          name: 'sysUser',
          component: SysUser
        },
        //角色管理
        {
          path: '/SysRole',
          name: 'sysRole',
          component: SysRole
        },
        //菜单管理
        {
          path: '/SysMenu',
          name: 'sysMenu',
          component: SysMenu
        },
        //系统日志
        {
          path: '/syslog',
          name: 'syslog',
          component: Syslog
        }
      ]
    },
    //登录页
    {
      path: '/Login',
      name: 'login', //主路由
      component: Login,
    }
  ]
})
